Skip to content

WIP: Add indent support in to_json #26457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

WillAyd
Copy link
Member

@WillAyd WillAyd commented May 19, 2019

This is a WIP and requires a little more refinement (namely around how level is incremented in the extension module, testing arrays) but is more or less the direction I think we could head in

This is mostly inspired by changes done in ultrajson/ultrajson@930dfa5#diff-edae06c872e58ad6edf574f4414aac9f

@WillAyd WillAyd added the IO JSON read_json, to_json, json_normalize label May 19, 2019
@WillAyd WillAyd changed the title Add indent support in to_json WIP: Add indent support in to_json May 19, 2019
@@ -981,13 +996,17 @@ void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name,
enc->iterBegin(obj, &tc);

Buffer_AppendCharUnchecked(enc, '{');
Buffer_AppendIndentNewlineUnchecked (enc);
Buffer_AppendIndentUnchecked (enc, enc->level + 2);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned this + 2 isn't permanent just a hack during WIP to get this to work. Something seems off with the level struct member I just haven't figured out yet

@codecov
Copy link

codecov bot commented May 19, 2019

Codecov Report

Merging #26457 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26457      +/-   ##
==========================================
- Coverage   91.73%   91.72%   -0.01%     
==========================================
  Files         174      174              
  Lines       50754    50755       +1     
==========================================
- Hits        46560    46557       -3     
- Misses       4194     4198       +4
Flag Coverage Δ
#multiple 90.23% <100%> (ø) ⬆️
#single 41.69% <100%> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/core/generic.py 93.49% <ø> (ø) ⬆️
pandas/io/json/json.py 93.25% <100%> (+0.01%) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 97.02% <0%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 80bddaf...367b494. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented May 19, 2019

Codecov Report

Merging #26457 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26457      +/-   ##
==========================================
- Coverage   91.73%   91.72%   -0.01%     
==========================================
  Files         174      174              
  Lines       50754    50755       +1     
==========================================
- Hits        46560    46557       -3     
- Misses       4194     4198       +4
Flag Coverage Δ
#multiple 90.23% <100%> (ø) ⬆️
#single 41.69% <100%> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/core/generic.py 93.49% <ø> (ø) ⬆️
pandas/io/json/json.py 93.25% <100%> (+0.01%) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 97.02% <0%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 80bddaf...367b494. Read the comment docs.

@WillAyd
Copy link
Member Author

WillAyd commented May 20, 2019

Meant to open this as a draft PR - going to close to get it out of the queue but do plan on picking back up in the near term

@WillAyd WillAyd closed this May 20, 2019
@WillAyd WillAyd deleted the json-indent branch January 16, 2020 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO JSON read_json, to_json, json_normalize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add indent support to to_json method
1 participant